package com.hc.server.conn.bill;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class BillResponse {
	private int retCode;
	private JSONObject respContent;
	
//	private static final String ACTION_NAME = "ACTION_NAME";
//	private static final String ACTION_INVOKER = "ACTION_INVOKER";
//	private static final String ACTION_MODULE = "ACTION_MODULE";
	private static final String ACTION_RETURN_CODE = "ACTION_RETURN_CODE";
//	private static final String ACTION_RETURN_MESSAGE = "ACTION_RETURN_MESSAGE";
	private static final String ACTION_INFO = "ACTION_INFO";

	public static BillResponse parser(String respMsg) throws JSONException {
		JSONObject tmp = new JSONArray(respMsg).getJSONObject(0);;
		BillResponse resp = new BillResponse();
		resp.retCode = tmp.getInt(ACTION_RETURN_CODE);
		resp.respContent = tmp.getJSONObject(ACTION_INFO);
		return resp;
	}
	
	private BillResponse() {
	}

	public int getRetCode(){
		return this.retCode;
	}
	
	public JSONObject getResult(){
		return this.respContent;
	}
}
